package cc.yugu.yhdw.common.domain.hdw;

import cc.yugu.yhdw.common.annotation.Transient;
import cc.yugu.yhdw.common.domain.LongIdEntity;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 换电套餐
 */
public class ExchangePrice extends LongIdEntity {
    Integer agentId;        //运营商ID
    String priceName;       //套餐名称
    Integer type;            //套餐类型 1 日常套餐 2 活动套餐
    Integer activeType;     //1 按此 2 按量
    Date createTime;
    // 新添加
    Integer agencyId;   // 代理商id

    @Transient
    String agentName,agencyName;
    // 运营商代理商对应的换电价格
    Integer timesPrice;

    public Integer getTimesPrice() {
        return timesPrice;
    }

    public void setTimesPrice(Integer timesPrice) {
        this.timesPrice = timesPrice;
    }

    public enum Type {
        EVERYDAY(1, "日常套餐"),
        ACTIVITY(2, "活动套餐")
        ;

        private final int value;
        private final String name;

        Type(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();
        static {
            for (Type e : Type.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public enum ActiveType {
        TIMES(1, "按次")
        ;

        private final int value;
        private final String name;

        ActiveType(int value, String name) {
            this.value = value;
            this.name = name;
        }

        private static Map<Integer, String> map = new HashMap<Integer, String>();
        static {
            for (ActiveType e : ActiveType.values()) {
                map.put(e.getValue(), e.getName());
            }
        }

        public static String getName(int value) {
            return map.get(value);
        }

        public int getValue() {
            return value;
        }

        public String getName() {
            return name;
        }
    }

    public String getActiveTypeName() {
        if(activeType != null) {
            return ActiveType.getName(activeType);
        }
        return "";
    }

    public String getTypeName() {
        if(type != null) {
            return Type.getName(type);
        }
        return "";
    }

    public Integer getAgentId() {
        return agentId;
    }

    public void setAgentId(Integer agentId) {
        this.agentId = agentId;
    }
    /* 新增加  */
    public Integer getAgencyId() {
        return agencyId;
    }

    public void setAgencyId(Integer agencyId) {
        this.agencyId = agencyId;
    }

    public String getPriceName() {
        return priceName;
    }

    public void setPriceName(String priceName) {
        this.priceName = priceName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getActiveType() {
        return activeType;
    }

    public void setActiveType(Integer activeType) {
        this.activeType = activeType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getAgentName() {
        return agentName;
    }

    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }

    // 新增加
    public String getAgencyName() {
        return agencyName;
    }

    public void setAgencyName(String agencyName) {
        this.agencyName = agencyName;
    }
}
